home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / Ecore_Data.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-01-09  |  17.9 KB  |  545 lines

  1. #ifndef _ECORE_DATA_H
  2. # define _ECORE_DATA_H
  3.  
  4. #ifdef EAPI
  5. #undef EAPI
  6. #endif
  7. #ifdef WIN32
  8. # ifdef BUILDING_DLL
  9. #  define EAPI __declspec(dllexport)
  10. # else
  11. #  define EAPI __declspec(dllimport)
  12. # endif
  13. #else
  14. # ifdef __GNUC__
  15. #  if __GNUC__ >= 4
  16. #   define EAPI __attribute__ ((visibility("default")))
  17. #  else
  18. #   define EAPI
  19. #  endif
  20. # else
  21. #  define EAPI
  22. # endif
  23. #endif
  24.  
  25. /**
  26.  * @file Ecore_Data.h
  27.  * @brief Contains threading, list, hash, debugging and tree functions.
  28.  */
  29.  
  30. # ifdef __cplusplus
  31. extern "C" {
  32. # endif
  33.  
  34. # ifdef __sgi
  35. #  define __FUNCTION__ "unknown"
  36. #  ifndef __cplusplus
  37. #   define inline
  38. #  endif
  39. # endif
  40.    
  41.    EAPI extern const unsigned int ecore_prime_table[];
  42.    
  43.    typedef void (*Ecore_For_Each) (void *value, void *user_data);
  44. # define ECORE_FOR_EACH(function) ((Ecore_For_Each)function)
  45.    
  46.    typedef void (*Ecore_Free_Cb) (void *data);
  47. # define ECORE_FREE_CB(func) ((Ecore_Free_Cb)func)
  48.    
  49.    typedef unsigned int (*Ecore_Hash_Cb) (void *key);
  50. # define ECORE_HASH_CB(function) ((Ecore_Hash_Cb)function)
  51.    
  52.    typedef int (*Ecore_Compare_Cb) (void *data1, void *data2);
  53. # define ECORE_COMPARE_CB(function) ((Ecore_Compare_Cb)function)
  54.    
  55. # ifdef HAVE_PTHREADS /* pthreads are installed */
  56.    
  57. #  include <pthread.h>
  58.    
  59. #  define ECORE_DECLARE_LOCKS \
  60.    struct { \
  61.       int readers; \
  62.       pthread_mutex_t readers_mutex; \
  63.       pthread_mutex_t writers_mutex; \
  64.       pthread_cond_t readers_cond; \
  65.    } locks
  66.    
  67. #  define ECORE_INIT_LOCKS(structure) \
  68.      if (structure) { \
  69.     structure->readers = 0; \
  70.     pthread_mutex_init(&structure->locks.readers_mutex, NULL); \
  71.     pthread_mutex_init(&structure->locks.writers_mutex, NULL); \
  72.     pthread_cond_init(&structure->locks.readers_cond, NULL); \
  73.      }
  74.    
  75. #  define ECORE_DESTROY_LOCKS(structure) \
  76.    if (structure) { \
  77.       pthread_mutex_destroy(&structure->locks.readers_mutex); \
  78.       pthread_mutex_destroy(&structure->locks.writers_mutex); \
  79.       pthread_cond_destroy(&structure->readers_cond); \
  80.    }
  81.    
  82. #  define ECORE_READ_LOCK(structure) \
  83.    if (structure) { \
  84.       pthread_mutex_lock(&structure->locks.readers_mutex); \
  85.       structure->locks.readers++; \
  86.       pthread_mutex_unlock(&structure->locks.readers_mutex); \
  87.    }
  88.    
  89. #  define ECORE_READ_UNLOCK(structure) \
  90.    if (structure) { \
  91.       pthread_mutex_lock(&structure->locks.readers_mutex); \
  92.       if (--structure->locks.readers == 0) \
  93.     pthread_cond_broadcast(&structure->locks.readers_cond); \
  94.       pthread_mutex_unlock(&structure->locks.readers_mutex); \
  95.    }
  96.    
  97. #  define ECORE_WRITE_LOCK(structure) \
  98.    if (structure) { \
  99.       pthread_mutex_lock(&structure->locks.readers_mutex); \
  100.       pthread_mutex_lock(&structure->locks.writers_mutex); \
  101.       while (structure->locks.readers > 0) \
  102.     pthread_cond_wait(&structure->locks.readers_cond, \
  103.                  &structure->locks.readers_mutex); \
  104.       pthread_mutex_unlock(&structure->locks.readers_mutex); \
  105.    }
  106.    
  107. #  define ECORE_WRITE_UNLOCK(structure) \
  108.    if (structure) \
  109.        pthread_mutex_unlock(&structure->locks.writers_mutex); \
  110.    
  111. #  define ECORE_THREAD_CREATE(function, arg) \
  112.    if (function) { \
  113.       pthread_t thread; \
  114.       pthread_create(&thread, NULL, function, arg); \
  115.       pthread_detach(thread); \
  116.    }
  117.    
  118. #  define ECORE_NO_THREADS(function, arg)
  119.    
  120. # else /* No pthreads available */
  121.  
  122. #  define ECORE_DECLARE_LOCKS 
  123. #  define ECORE_INIT_LOCKS(structure)
  124. #  define ECORE_READ_LOCK(structure)
  125. #  define ECORE_READ_UNLOCK(structure)
  126. #  define ECORE_WRITE_LOCK(structure)
  127. #  define ECORE_WRITE_UNLOCK(structure)
  128. #  define ECORE_THREAD_CREATE(function, args)
  129. #  define ECORE_DESTROY_LOCKS(structure)
  130.    
  131. #  define ECORE_NO_THREADS(function, arg) if (function) function(arg);
  132.    
  133. # endif   /* HAVE_PTHREADS */
  134.    
  135.    typedef struct _ecore_list Ecore_List;
  136. # define ECORE_LIST(list) ((Ecore_List *)list)
  137.    
  138.    typedef struct _ecore_list_node Ecore_List_Node;
  139. # define ECORE_LIST_NODE(node) ((Ecore_List_Node *)node)
  140.    
  141.    struct _ecore_list_node {
  142.       void *data;
  143.       struct _ecore_list_node *next;
  144.       
  145.       ECORE_DECLARE_LOCKS;
  146.    };
  147.    
  148.    struct _ecore_list {
  149.       Ecore_List_Node *first;    /* The first node in the list */
  150.       Ecore_List_Node *last;    /* The last node in the list */
  151.       Ecore_List_Node *current;    /* The current node in the list */
  152.       
  153.       Ecore_Free_Cb free_func;  /* The callback to free data in nodes */
  154.       
  155.       int nodes;        /* The number of nodes in the list */
  156.       int index;        /* The position from the front of the
  157.                  list of current node */
  158.       ECORE_DECLARE_LOCKS;
  159.    };
  160.    
  161.    EAPI int ecore_direct_compare(void *key1, void *key2);
  162.    EAPI int ecore_str_compare(void *key1, void *key2);
  163.    
  164.    EAPI unsigned int ecore_direct_hash(void *key);
  165.    EAPI unsigned int ecore_str_hash(void *key);
  166.    
  167.    /* Creating and initializing new list structures */
  168.    EAPI Ecore_List *ecore_list_new(void);
  169.    EAPI int ecore_list_init(Ecore_List *list);
  170.    
  171.    /* Adding items to the list */
  172.    EAPI int ecore_list_append(Ecore_List * list, void *_data);
  173.    EAPI int ecore_list_prepend(Ecore_List * list, void *_data);
  174.    EAPI int ecore_list_insert(Ecore_List * list, void *_data);
  175.    
  176.    /* Removing items from the list */
  177.    EAPI int ecore_list_remove_destroy(Ecore_List *list);
  178.    EAPI void *ecore_list_remove(Ecore_List * list);
  179.    EAPI void *ecore_list_remove_first(Ecore_List * list);
  180.    EAPI void *ecore_list_remove_last(Ecore_List * list);
  181.    
  182.    /* Retrieve the current position in the list */
  183.    EAPI void *ecore_list_current(Ecore_List * list);
  184.    EAPI int ecore_list_index(Ecore_List * list);
  185.    EAPI int ecore_list_nodes(Ecore_List * list);
  186.    
  187.    /* Traversing the list */
  188.    EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
  189.                 void *user_data);
  190.    EAPI void *ecore_list_goto_first(Ecore_List * list);
  191.    EAPI void *ecore_list_goto_last(Ecore_List * list);
  192.    EAPI void *ecore_list_goto_index(Ecore_List * list, int index);
  193.    EAPI void *ecore_list_goto(Ecore_List * list, void *_data);
  194.    
  195.    /* Traversing the list and returning data */
  196.    EAPI void *ecore_list_next(Ecore_List * list);
  197.    
  198.    /* Check to see if there is any data in the list */
  199.    EAPI int ecore_list_is_empty(Ecore_List * list);
  200.    
  201.    /* Remove every node in the list without freeing the list itself */
  202.    EAPI int ecore_list_clear(Ecore_List * list);
  203.    /* Free the list and it's contents */
  204.    EAPI void ecore_list_destroy(Ecore_List *list);
  205.    
  206.    /* Creating and initializing list nodes */
  207.    EAPI Ecore_List_Node *ecore_list_node_new(void);
  208.    EAPI int ecore_list_node_init(Ecore_List_Node *newNode);
  209.    
  210.    /* Destroying nodes */
  211.    EAPI int ecore_list_node_destroy(Ecore_List_Node * _e_node, Ecore_Free_Cb free_func);
  212.    
  213.    EAPI int ecore_list_set_free_cb(Ecore_List * list, Ecore_Free_Cb free_func);
  214.    
  215.    typedef Ecore_List Ecore_DList;
  216. # define ECORE_DLIST(dlist) ((Ecore_DList *)dlist)
  217.    
  218.    typedef struct _ecore_dlist_node Ecore_DList_Node;
  219. # define ECORE_DLIST_NODE(dlist) ((Ecore_DList_Node *)dlist)
  220.    
  221.    struct _ecore_dlist_node {
  222.       Ecore_List_Node single;
  223.       Ecore_DList_Node *previous;
  224.    };
  225.    
  226.    /* Creating and initializing new list structures */
  227.    EAPI Ecore_DList *ecore_dlist_new(void);
  228.    EAPI int ecore_dlist_init(Ecore_DList *list);
  229.    EAPI void ecore_dlist_destroy(Ecore_DList *list);
  230.    
  231.    /* Adding items to the list */
  232.    EAPI int ecore_dlist_append(Ecore_DList * _e_dlist, void *_data);
  233.    EAPI int ecore_dlist_prepend(Ecore_DList * _e_dlist, void *_data);
  234.    EAPI int ecore_dlist_insert(Ecore_DList * _e_dlist, void *_data);
  235.    
  236.    /* Info about list's state */
  237.    EAPI void *ecore_dlist_current(Ecore_DList *list);
  238.    EAPI int ecore_dlist_index(Ecore_DList *list);
  239. # define ecore_dlist_nodes(list) ecore_list_nodes(ECORE_LIST(list))
  240.    
  241.    /* Removing items from the list */
  242.    EAPI void *ecore_dlist_remove(Ecore_DList * _e_dlist);
  243.    EAPI void *ecore_dlist_remove_first(Ecore_DList * _e_dlist);
  244.    EAPI int ecore_dlist_remove_destroy(Ecore_DList *list);
  245.    EAPI void *ecore_dlist_remove_last(Ecore_DList * _e_dlist);
  246.    
  247.    /* Traversing the list */
  248. # define ecore_dlist_for_each(list, function, user_data) \
  249.    ecore_list_for_each(ECORE_LIST(list), function, user_data)
  250.    EAPI void *ecore_dlist_goto_first(Ecore_DList * _e_dlist);
  251.    EAPI void *ecore_dlist_goto_last(Ecore_DList * _e_dlist);
  252.    EAPI void *ecore_dlist_goto_index(Ecore_DList * _e_dlist, int index);
  253.    EAPI void *ecore_dlist_goto(Ecore_DList * _e_dlist, void *_data);
  254.    
  255.    /* Traversing the list and returning data */
  256.    EAPI void *ecore_dlist_next(Ecore_DList * list);
  257.    EAPI void *ecore_dlist_previous(Ecore_DList * list);
  258.    
  259.    /* Check to see if there is any data in the list */
  260.    EAPI int ecore_dlist_is_empty(Ecore_DList * _e_dlist);
  261.    
  262.    /* Remove every node in the list without free'ing it */
  263.    EAPI int ecore_dlist_clear(Ecore_DList * _e_dlist);
  264.    
  265.    /* Creating and initializing list nodes */
  266.    EAPI int ecore_dlist_node_init(Ecore_DList_Node * node);
  267.    EAPI Ecore_DList_Node *ecore_dlist_node_new(void);
  268.    
  269.    /* Destroying nodes */
  270.    EAPI int ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func);
  271.    
  272.    EAPI int ecore_dlist_set_free_cb(Ecore_DList * dlist, Ecore_Free_Cb free_func);
  273.    
  274.    
  275.    
  276.    /*
  277.     * Hash Table Implementation:
  278.     * 
  279.     * Traditional hash table implementation. I had tried a list of tables
  280.     * approach to save on the realloc's but it ended up being much slower than
  281.     * the traditional approach.
  282.     */
  283.    
  284.    typedef struct _ecore_hash_node Ecore_Hash_Node;
  285. # define ECORE_HASH_NODE(hash) ((Ecore_Hash_Node *)hash)
  286.    
  287.    struct _ecore_hash_node {
  288.       Ecore_Hash_Node *next; /* Pointer to the next node in the bucket list */
  289.       void *key;         /* The key for the data node */
  290.       void *value;         /* The value associated with this node */
  291.       
  292.       ECORE_DECLARE_LOCKS;
  293.    };
  294.    
  295.    typedef struct _ecore_hash Ecore_Hash;
  296. # define ECORE_HASH(hash) ((Ecore_Hash *)hash)
  297.    
  298.    struct _ecore_hash {
  299.       Ecore_Hash_Node **buckets;
  300.       int size;        /* An index into the table of primes to
  301.              determine size */
  302.       int nodes;        /* The number of nodes currently in the hash */
  303.  
  304.       int index;    /* The current index into the bucket table */
  305.       
  306.       Ecore_Compare_Cb compare;    /* The function used to compare node values */
  307.       Ecore_Hash_Cb hash_func;    /* The function used to compare node values */
  308.       
  309.       Ecore_Free_Cb free_key;    /* The callback function to free key */
  310.       Ecore_Free_Cb free_value;    /* The callback function to determine hash */
  311.       
  312.       ECORE_DECLARE_LOCKS;
  313.    };
  314.    
  315.    /* Create and initialize a hash */
  316.    EAPI Ecore_Hash *ecore_hash_new(Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
  317.    EAPI int ecore_hash_init(Ecore_Hash *hash, Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
  318.    
  319.    /* Functions related to freeing the data in the hash table */
  320.    EAPI int ecore_hash_set_free_key(Ecore_Hash *hash, Ecore_Free_Cb function);
  321.    EAPI int ecore_hash_set_free_value(Ecore_Hash *hash, Ecore_Free_Cb function);
  322.    EAPI void ecore_hash_destroy(Ecore_Hash *hash);
  323.  
  324.    EAPI int ecore_hash_for_each_node(Ecore_Hash *hash, Ecore_For_Each for_each_func,
  325.                      void *user_data);
  326.    EAPI Ecore_List *ecore_hash_keys(Ecore_Hash *hash);
  327.    
  328.    /* Retrieve and store data into the hash */
  329.    EAPI void *ecore_hash_get(Ecore_Hash *hash, void *key);
  330.    EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value);
  331.    EAPI void *ecore_hash_remove(Ecore_Hash *hash, void *key);
  332.    EAPI void ecore_hash_dump_graph(Ecore_Hash *hash);
  333.  
  334.  
  335.    typedef struct _ecore_path_group Ecore_Path_Group;
  336.    struct _ecore_path_group
  337.      {
  338.     int id;
  339.     char *name;
  340.     Ecore_List *paths;
  341.      };
  342.    
  343.    /*
  344.     * Create a new path group
  345.     */
  346.    EAPI int ecore_path_group_new(char *group_name);
  347.    
  348.    /*
  349.     * Destroy a previous path group
  350.     */
  351.    EAPI void ecore_path_group_del(int group_id);
  352.    
  353.    /*
  354.     * Add a directory to be searched for files
  355.     */
  356.    EAPI void ecore_path_group_add(int group_id, char *path);
  357.    
  358.    /*
  359.     * Remove a directory to be searched for files
  360.     */
  361.    EAPI void ecore_path_group_remove(int group_id, char *path);
  362.    
  363.    /*
  364.     * Find the absolute path if it exists in the group of paths
  365.     */
  366.    EAPI char * ecore_path_group_find(int group_id, char *name);
  367.    
  368.    /*
  369.     * Get a list of all the available files in a path set
  370.     */
  371.    EAPI Ecore_List * ecore_path_group_available(int group_id);
  372.    
  373.    
  374.    typedef struct _ecore_plugin Ecore_Plugin;
  375.    struct _ecore_plugin
  376.      {
  377.     int group;
  378.     char *name;
  379.     void *handle;
  380.      };
  381.    
  382.    /*
  383.     * Load the specified plugin
  384.     */
  385.    EAPI Ecore_Plugin *ecore_plugin_load(int group_id, char *plugin);
  386.    
  387.    /*
  388.     * Unload the specified plugin
  389.     */
  390.    EAPI void ecore_plugin_unload(Ecore_Plugin * plugin);
  391.    
  392.    /*
  393.     * Lookup the specified symbol for the plugin
  394.     */
  395.    EAPI void *ecore_plugin_call(Ecore_Plugin * plugin, char *symbol_name);
  396.    
  397.    EAPI Ecore_List *ecore_plugin_get_available(int group_id);
  398.  
  399.  
  400. # define ECORE_SHEAP_MIN 0
  401. # define ECORE_SHEAP_MAX 1
  402.  
  403.    typedef struct _ecore_heap Ecore_Sheap;
  404. # define ECORE_HEAP(heap) ((Ecore_Sheap *)heap)
  405.    
  406.    struct _ecore_heap {
  407.       void **data;
  408.       int size;
  409.       int space;
  410.       
  411.       char order, sorted;
  412.       
  413.       /* Callback for comparing node values, default is direct comparison */
  414.       Ecore_Compare_Cb compare;
  415.  
  416.       /* Callback for freeing node data, default is NULL */
  417.       Ecore_Free_Cb free_func;
  418.    };
  419.    
  420.    EAPI Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size);
  421.    EAPI void ecore_sheap_destroy(Ecore_Sheap *heap);
  422.    EAPI int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size);
  423.    EAPI int ecore_sheap_set_free_cb(Ecore_Sheap *heap, Ecore_Free_Cb free_func);
  424.    EAPI int ecore_sheap_insert(Ecore_Sheap *heap, void *data);
  425.    EAPI void *ecore_sheap_extract(Ecore_Sheap *heap);
  426.    EAPI void *ecore_sheap_extreme(Ecore_Sheap *heap);
  427.    EAPI int ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval);
  428.    EAPI int ecore_sheap_set_compare(Ecore_Sheap *heap, Ecore_Compare_Cb compare);
  429.    EAPI void ecore_sheap_set_order(Ecore_Sheap *heap, char order);
  430.    EAPI void ecore_sheap_sort(Ecore_Sheap *heap);
  431.    
  432.    EAPI void *ecore_sheap_item(Ecore_Sheap *heap, int i);
  433.    
  434.    
  435.    typedef struct _ecore_string Ecore_String;
  436.    struct _ecore_string {
  437.       char *string;
  438.       int references;
  439.    };
  440.    
  441.    EAPI int ecore_string_init(void);
  442.    EAPI void ecore_string_shutdown(void);
  443.    EAPI const char *ecore_string_instance(char *string);
  444.    EAPI void ecore_string_release(const char *string);
  445.    
  446.    
  447.    typedef struct _Ecore_Tree_Node Ecore_Tree_Node;
  448. # define ECORE_TREE_NODE(object) ((Ecore_Tree_Node *)object)
  449.    struct _Ecore_Tree_Node {
  450.       
  451.       /* The actual data for each node */
  452.       void *key;
  453.       void *value;
  454.       
  455.       /* Pointers to surrounding nodes */
  456.       Ecore_Tree_Node *parent;
  457.       Ecore_Tree_Node *left_child;
  458.       Ecore_Tree_Node *right_child;
  459.       
  460.       /* Book keeping information for quicker balancing of the tree */
  461.       int max_right;
  462.       int max_left;
  463.       
  464.       ECORE_DECLARE_LOCKS;
  465.    };
  466.    
  467.    typedef struct _Ecore_Tree Ecore_Tree;
  468. # define ECORE_TREE(object) ((Ecore_Tree *)object)
  469.    struct _Ecore_Tree {
  470.       /* Nodes of the tree */
  471.       Ecore_Tree_Node *tree;
  472.       
  473.       /* Callback for comparing node values, default is direct comparison */
  474.       Ecore_Compare_Cb compare_func;
  475.       
  476.       /* Callback for freeing node data, default is NULL */
  477.       Ecore_Free_Cb free_func;
  478.       
  479.       ECORE_DECLARE_LOCKS;
  480.    };
  481.    
  482.    /* Some basic tree functions */
  483.    /* Allocate and initialize a new tree */
  484.    EAPI Ecore_Tree *ecore_tree_new(Ecore_Compare_Cb compare_func);
  485.    /* Initialize a new tree */
  486.    EAPI int ecore_tree_init(Ecore_Tree * tree, Ecore_Compare_Cb compare_func);
  487.    
  488.    /* Free the tree */
  489.    EAPI int ecore_tree_destroy(Ecore_Tree * tree);
  490.    /* Check to see if the tree has any nodes in it */
  491.    EAPI int ecore_tree_is_empty(Ecore_Tree * tree);
  492.    
  493.    /* Retrieve the value associated with key */
  494.    EAPI void *ecore_tree_get(Ecore_Tree * tree, void *key);
  495.    EAPI Ecore_Tree_Node *ecore_tree_get_node(Ecore_Tree * tree, void *key);
  496.    /* Retrieve the value of node with key greater than or equal to key */
  497.    EAPI void *ecore_tree_get_closest_larger(Ecore_Tree * tree, void *key);
  498.    /* Retrieve the value of node with key less than or equal to key */
  499.    EAPI void *ecore_tree_get_closest_smaller(Ecore_Tree * tree, void *key);
  500.    
  501.    /* Set the value associated with key to value */
  502.    EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value);
  503.    /* Remove the key from the tree */
  504.    EAPI int ecore_tree_remove(Ecore_Tree * tree, void *key);
  505.    
  506.    /* Add a node to the tree */
  507.    EAPI int ecore_tree_add_node(Ecore_Tree * tree, Ecore_Tree_Node * node);
  508.    /* Remove a node from the tree */
  509.    EAPI int ecore_tree_remove_node(Ecore_Tree * tree, Ecore_Tree_Node * node);
  510.    
  511.    /* For each node in the tree perform the for_each_func function */
  512.    /* For this one pass in the node */
  513.    EAPI int ecore_tree_for_each_node(Ecore_Tree * tree, Ecore_For_Each for_each_func,
  514.                      void *user_data);
  515.    /* And here pass in the node's value */
  516.    EAPI int ecore_tree_for_each_node_value(Ecore_Tree * tree,
  517.                        Ecore_For_Each for_each_func,
  518.                        void *user_data);
  519.    
  520.    /* Some basic node functions */
  521.    /* Initialize a node */
  522.    EAPI int ecore_tree_node_init(Ecore_Tree_Node * new_node);
  523.    /* Allocate and initialize a new node */
  524.    EAPI Ecore_Tree_Node *ecore_tree_node_new(void);
  525.    /* Free the desired node */
  526.    EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node, Ecore_Free_Cb free_data);
  527.    
  528.    /* Set the node's key to key */
  529.    EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key);
  530.    /* Retrieve the key in node */
  531.    EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node);
  532.    
  533.    /* Set the node's value to value */
  534.    EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value);
  535.    /* Retrieve the value in node */
  536.    EAPI void *ecore_tree_node_value_get(Ecore_Tree_Node * node);
  537.    
  538.    /* Add a function to free the data stored in nodes */
  539.    EAPI int ecore_tree_set_free_cb(Ecore_Tree * tree, Ecore_Free_Cb free_func);
  540.  
  541. #ifdef __cplusplus
  542. }
  543. #endif
  544. #endif                /* _ECORE_DATA_H */
  545.